package com.school.test; // 测试类放test包

import com.school.course.Course;
import com.school.entity.Teacher;
import com.school.entity.Student;

public class TestSystem {
    public static void main(String[] args) {
        // 1. 创建教师对象（子类对象初始化，自动调用父类构造）
        Teacher teacher1 = new Teacher("T001", "张三", "男");
        Teacher teacher2 = new Teacher("T002", "李四", "女");

        // 2. 创建课程对象（跨包访问Course，依赖public构造和Getter）
        Course course1 = new Course("C001", "Java程序设计", "教学楼A101", "周一3-4节", 3, teacher1);
        Course course2 = new Course("C002", "Python数据分析", "教学楼B202", "周三5-6节", 2, teacher2);

        // 3. 教师开课+打印教师信息（验证重写的printInfo()）
        teacher1.openCourse(course1);
        teacher2.openCourse(course2);
        System.out.println("\n----- 教师信息 -----");
        teacher1.printInfo();
        teacher2.printInfo();

        // 4. 创建学生对象
        Student student1 = new Student("S001", "小明", "男");
        Student student2 = new Student("S002", "小红", "女");

        // 5. 学生选课+打印学生信息（验证重写的printInfo()）
        student1.selectCourse(course1);
        student2.selectCourse(course2);
        student1.selectCourse(course2); // 重复选课（预期失败）
        System.out.println("\n----- 学生信息 -----");
        student1.printInfo();
        student2.printInfo();

        // 6. 打印课表
        student1.printSchedule();
        student2.printSchedule();

        // 7. 退课
        student1.dropCourse();
        student2.dropCourse();
        student1.dropCourse(); // 重复退课（预期失败）

        // 8. 退课后打印课表和学生信息
        System.out.println("\n----- 退课后学生信息 -----");
        student1.printInfo();
        student2.printInfo();
        student1.printSchedule();
        student2.printSchedule();
    }
}